

import {Route} from "react-router-dom"
import routeMap from "./routeMap"

function createRoute(routeArr){
    // console.log("routeArr",JSON.parse(routeArr))
    return routeArr.map((item)=>{
        if(item.children && item.children.length > 0){
            return <Route path={item.path} Component={routeMap[item.component]} key={item.path}>
                createRoute(item.children)
            </Route>
        }else{
            return <Route path={item.path} Component={routeMap[item.component]} key={item.path}></Route>
        }
    })
}

export default createRoute